<div style="margin: auto">
    <form id="tag_add_form" class="layui-form layui-form-pane" method="post" th:action="${action}">
        <input type="hidden" name="id" th:value="${tag.id}">
        <div style="margin: 40px;">
            <div class="layui-form-item">
                <label class="layui-form-label">中文名</label>
                <div class="layui-input-block">
                    <input autocomplete="off" class="layui-input" name="name" lay-verify="required" th:value="${tag.name}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">英文名</label>
                <div class="layui-input-block">
                    <input autocomplete="off" class="layui-input" name="value" lay-verify="required" th:value="${tag.value}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">状态</label>
                <div class="layui-input-block">
                    <input autocomplete="off" class="layui-input" name="state" th:value="${tag.state}">
                </div>
            </div>
            <div class="layui-footer" style="margin: auto;display:none">
                <button id="tag_add_submit" type="submit" class="layui-btn" lay-submit lay-filter="tag_add_submit">立即提交</button>
            </div>
        </div>
    </form>
</div>

<script type="text/javascript">
    $(function () {
        $('#tag_add_form').submit(function () {
            $.ajax({
                url:$(this).attr('action'),
                type: 'post',
                data: $(this).serialize(),
                success:function(result){
                    if (result.state == "success"){
                        tag_index_js.layer.close(tag_index_js.layerIndex);
                        tag_index_js.page_init(tag_index_js.pno, tag_index_js.psize);
                        tag_index_js.layer.msg(result.message);
                    }else {
                        tag_index_js.layer.msg(result.message);
                    }
                }});
            return false;
        });
    });
</script>